package exam.driver.jdbc;

public class WhereComplex extends WhereSimple<WhereComplex>{
	/**
	 * Phuong thuc khoi tao
	 */
	public WhereComplex() {
		super();
	}
	
	/**
	 * AND(condition)
	 */
	public WhereComplex and(WhereComplex whereComplex) {
		this.whereString.append(" AND (").append(whereComplex.toString()).append(") ");
		return this;
	}
	
	/**
	 * OR(condition)
	 */
	public WhereComplex or(WhereComplex whereComplex) {
		this.whereString.append(" OR (").append(whereComplex.toString()).append(") ");
		return this;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return this.whereString.toString();
	}
	public static void main(String[] args) {
		System.out.println(new WhereComplex()
				.eq("id", "1")
				.or()
				.eq("id", "2")
				.toString());
	}
}
